package com.shop.shard.controller.assembler.order;

import com.shop.shard.controller.command.order.OrderOrderCreateCommand;
import com.shop.shard.controller.command.order.OrderOrderUpdateCommand;
import com.shop.shard.entity.order.OrderOrder;

import java.util.Date;

/**
 * @Description: 代码生成器自动生成
 * @author:
 * @Createed Date: 2019-8-16 10:06:57
 * @ModificationHistory: Who  When  What
 * ---------     -------------   --------------------------------------
 **/
public class OrderOrderAssembler{
    public static OrderOrder toOrderOrder(OrderOrderCreateCommand command){
        OrderOrder entity = new OrderOrder();
        /** 订单号*/
        entity.setOrderNo(command.getOrderNo());
        /** 用户id*/
        entity.setUserId(command.getUserId());
        /** 订单总额*/
        entity.setOrderAmount(command.getOrderAmount());
        /** 订单状态，1-进行中，2-已完成，3-已取消*/
        entity.setOrderStatus(command.getOrderStatus());
        /** 留言*/
        entity.setRemark(command.getRemark());
        Date currentDate = new Date();
        entity.setCreateDate(currentDate);
        entity.setUpdateDate(currentDate);
        return entity;
    }

    public static OrderOrder toOrderOrder(OrderOrderUpdateCommand command){
        OrderOrder entity = new OrderOrder();
        /** 主键*/
        entity.setOrderId(command.getOrderId());
        /** 订单号*/
        entity.setOrderNo(command.getOrderNo());
        /** 用户id*/
        entity.setUserId(command.getUserId());
        /** 订单总额*/
        entity.setOrderAmount(command.getOrderAmount());
        /** 订单状态，1-进行中，2-已完成，3-已取消*/
        entity.setOrderStatus(command.getOrderStatus());
        /** 留言*/
        entity.setRemark(command.getRemark());
        Date currentDate = new Date();
        entity.setUpdateDate(currentDate);
        return entity;
    }
}